<template>
	<view class="noticeDeatil container  flex-xy" v-if="showPage &&!!thisNotice">
		<view class="w90">
			<view class="fs34">{{ thisNotice.noticeTitle }}</view>
		</view>
		<view class="w90  flexBox mt20 mb20 co666">
			<view class="w50 flexItem tal">
				创建人：{{ thisNotice.createBy }}
			</view>
			<view class="w50 flexItem tar">
				{{ thisNotice.createTime }}
			</view>
		</view>
		<view class="w90 mt20">
			<rich-text :nodes="thisNotice.noticeContent" ></rich-text>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			index: null, //下标
			showPage: false, //没有登录不显示内容
			noticeList: [], //获取通知公告列表
			thisNotice: null
		};
	},
	methods: {
		// GET/mobileUser/notice/list获取通知公告列表
		getNoticeList() {
			var postObj = { url: '/mobileUser/notice/list', data: {} };
			this.getRequest(postObj)
				.then(res => {
					// console.log('res获取通知公告列表', res);
					if (res.data.code == 200) {
						this.noticeList = res.data.rows;
						this.thisNotice = res.data.rows[this.index];
						// 富文本序列化
						this.thisNotice.noticeContent = this.util.formatRichText(this.thisNotice.noticeContent);
						// console.log('当前公告', this.thisNotice);
					}
				})
				.catch(err => {
					// console.log('err获取通知公告列表', err);
				});
		}
	},

	onShow() {
		// if (this.showPage) {
		// 	this.getNoticeList(); //获取通知公告列表
		// }
	},
	onLoad(options) {

		if (this.judgeLoading(options)) {
			this.showPage = true;
		}


		let index = options.index;
		this.index = index;
		// console.log('第',index)
		this.getNoticeList();
	}
};
</script>

<style lang="less" scoped>
	page{
		background: #FFFFFF;
	}
</style>
